package org.ru.mse10.cvis.dto.cv;

import java.util.Date;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.xml.bind.annotation.XmlRootElement;

import org.ru.mse10.cvis.dto.BaseDTO;
import org.ru.mse10.cvis.entity.cv.CvData;

/**
 * The Class CvSearchDTO.
 * 
 * @author Spawn
 */
@XmlRootElement
@ViewScoped
@ManagedBean(name = "cvDto")
public class CvSearchDTO extends BaseDTO<CvData> {

	/** The title. */
	private String title;

	/** The country. */
	private String country;

	/** The city. */
	private String city;

	/** The qualification. */
	private String qualification;

	/** The institution. */
	private String institution;
	// stepen na obrazovanie
	/** The degree. */
	private String degree;

	/** The language. */
	private String language;

	/** The date of birth. */
	private Date dateOfBirth;

	/** The nationality. */
	private String nationality;

	/** The role. */
	private String role;
	// umeniq
	/** The skill. */
	private String skill;
	// opit
	/** The expirience. */
	private String expirience;

	/**
	 * Gets the title.
	 * 
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * Sets the title.
	 * 
	 * @param title
	 *            the new title
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * Gets the country.
	 * 
	 * @return the country
	 */
	public String getCountry() {
		return country;
	}

	/**
	 * Sets the country.
	 * 
	 * @param country
	 *            the new country
	 */
	public void setCountry(String country) {
		this.country = country;
	}

	/**
	 * Gets the city.
	 * 
	 * @return the city
	 */
	public String getCity() {
		return city;
	}

	/**
	 * Sets the city.
	 * 
	 * @param city
	 *            the new city
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 * Gets the qualification.
	 * 
	 * @return the qualification
	 */
	public String getQualification() {
		return qualification;
	}

	/**
	 * Sets the qualification.
	 * 
	 * @param qualification
	 *            the new qualification
	 */
	public void setQualification(String qualification) {
		this.qualification = qualification;
	}

	/**
	 * Gets the institution.
	 * 
	 * @return the institution
	 */
	public String getInstitution() {
		return institution;
	}

	/**
	 * Sets the institution.
	 * 
	 * @param institution
	 *            the new institution
	 */
	public void setInstitution(String institution) {
		this.institution = institution;
	}

	/**
	 * Gets the degree.
	 * 
	 * @return the degree
	 */
	public String getDegree() {
		return degree;
	}

	/**
	 * Sets the degree.
	 * 
	 * @param degree
	 *            the new degree
	 */
	public void setDegree(String degree) {
		this.degree = degree;
	}

	/**
	 * Gets the language.
	 * 
	 * @return the language
	 */
	public String getLanguage() {
		return language;
	}

	/**
	 * Sets the language.
	 * 
	 * @param language
	 *            the new language
	 */
	public void setLanguage(String language) {
		this.language = language;
	}

	/**
	 * Gets the date of birth.
	 * 
	 * @return the date of birth
	 */
	public Date getDateOfBirth() {
		return dateOfBirth;
	}

	/**
	 * Sets the date of birth.
	 * 
	 * @param dateOfBirth
	 *            the new date of birth
	 */
	public void setDateOfBirth(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}

	/**
	 * Gets the nationality.
	 * 
	 * @return the nationality
	 */
	public String getNationality() {
		return nationality;
	}

	/**
	 * Sets the nationality.
	 * 
	 * @param nationality
	 *            the new nationality
	 */
	public void setNationality(String nationality) {
		this.nationality = nationality;
	}

	/**
	 * Gets the role.
	 * 
	 * @return the role
	 */
	public String getRole() {
		return role;
	}

	/**
	 * Sets the role.
	 * 
	 * @param role
	 *            the new role
	 */
	public void setRole(String role) {
		this.role = role;
	}

	/**
	 * Gets the skill.
	 * 
	 * @return the skill
	 */
	public String getSkill() {
		return skill;
	}

	/**
	 * Sets the skill.
	 * 
	 * @param skill
	 *            the new skill
	 */
	public void setSkill(String skill) {
		this.skill = skill;
	}

	/**
	 * Gets the expirience.
	 * 
	 * @return the expirience
	 */
	public String getExpirience() {
		return expirience;
	}

	/**
	 * Sets the expirience.
	 * 
	 * @param expirience
	 *            the new expirience
	 */
	public void setExpirience(String expirience) {
		this.expirience = expirience;
	}

	/**
	 * Method to check if fields are empty or null.
	 * 
	 * @return - true or false
	 */
	public boolean isEmptyOrNull() {
		if ((title == null || title.trim().isEmpty())
				&& (country == null || country.trim().isEmpty())
				&& (city == null || city.trim().isEmpty())
				&& (qualification == null || qualification.trim().isEmpty())
				&& (institution == null || institution.trim().isEmpty())
				&& (degree == null || degree.trim().isEmpty())
				&& (dateOfBirth == null || dateOfBirth.toString().trim()
						.isEmpty())
				&& (nationality == null || nationality.trim().isEmpty())
				&& (role == null || role.trim().isEmpty())
				&& (skill == null || skill.trim().isEmpty())
				&& (expirience == null || expirience.trim().isEmpty())
				&& (language == null || language.trim().isEmpty())) {
			return false;
		}
		return true;

	}
}
